import random
from typing import *
from sortedcontainers import SortedSet


class Solution:
    def getResults(self, queries: List[List[int]]) -> List[bool]:
        n = 50001 * 4
        mxs = [0] * n
        ss = [0] * n

        def push(root):
            if ss[root] > 0:
                ss[root << 1] = ss[root]
                ss[root << 1 | 1] = ss[root]
                ss[root] = 0
                mxs[root << 1] = mxs[root]
                mxs[root << 1 | 1] = mxs[root]

        def updatest(root, L, R, l, r, s):
            if l <= L and R <= r:
                mxs[root] = s
                ss[root] = s
                return
            push(root)
            m = ((R - L) >> 1) + L
            if l <= m:
                updatest(root << 1, L, m, l, r, s)
            if r > m:
                updatest(root << 1 | 1, m + 1, R, l, r, s)
            mxs[root] = max(mxs[root << 1], mxs[root << 1 | 1])

        def queryst(
            root,
            L,
            R,
            l,
            r,
        ):
            if l <= L and R <= r:
                return mxs[root]
            push(root)
            m = ((R - L) >> 1) + L
            ans = 0
            if l <= m:
                ans = queryst(root << 1, L, m, l, r)
            if r > m:
                ans = max(queryst(root << 1 | 1, m + 1, R, l, r), ans)
            return ans

        def query(l, r):
            return queryst(1, 0, 50001, l, r)

        def update(l, r, s):
            updatest(1, 0, 50001, l, r, s)

        xp = SortedSet()
        ans = []
        update(0, 50001, 50001)
        xp.add(0)
        xp.add(50001)
        for q in queries:
            t, x = q[0], q[1]
            lx = xp[xp.bisect_left(x) - 1]
            if t == 1:
                rx = xp[xp.bisect_right(x)]
                update(lx + 1 if lx > 0 else 0, x, x - lx)  # 这个边界问题
                update(x + 1, rx, rx - x)
                xp.add(x)
            else:
                mx = max(query(0, lx) if lx > 0 else x, x - lx)
                ans.append(mx >= q[2])

        return ans


s = Solution()
print(s.getResults([[1, 1], [1, 5], [1, 13], [1, 14], [2, 12, 8]]))
print(s.getResults([[2, 1, 2]]))
print(s.getResults([[1, 7], [2, 7, 6], [1, 2], [2, 7, 5], [2, 7, 6]]))
print(s.getResults([[1, 2], [2, 3, 3], [2, 3, 1], [2, 2, 2]]))
